SWEEP Generator : program overview

The program “SWEEP Generator” implements the software version of a ‘wobbler’ measuring set-up.

The figure shows the principle of the measure that can be obtained from this software approach.

Basically the PC commands the variable frequency generator, a DDS unit (1), the output (2) of the generator is connected to the device under test (DUT).

The output from the DUT (3) is detected and converted into a digital stream by an AD/C device

The samples are sent back (4) to the program that plots the graph on the PC screen.

Two different hardware configurations can be interfaced by the program:

Option A: the hardware is connected to the PC via the parallel port (LPT). The program directly drives the DDS unit and reads the output from the AD/C.

Option B: the DDS unit is driven by a PIC. The program interfaces via the USB / serial port the PIC sending commands and receiving back the samples acquired by the PIC. The AD/C function is implemented into the PIC.


The main window

Launching the program, the main window is presented:

Different areas can be identified :

Command area

In this area the START and STOP frequency and the running mode can be selected, from here the sweeping cycle is started and stopped

Graphic area

In this area the samples read back from the AD/C will be plotted, here the DUT output can be analyzed.

Auxiliary commands area

Special commands to interface additional devices like the input /output attenuators or the amplifier gain control are available in this area


Command area

The command area of the main window allows user to select the START and the STOP frequency, the sweeping mode and to run the measuring cycle.

START and STOP frequencies can be selected either by clicking any “arrow” that identify the single digit ‘thumbswitch’ style or entering the numeric value

with the keyboard.

Move the mouse over the frequency you want to change.

Click it, the program will present the value without the ‘decimal’ separators, enter the new frequency in Hz. Press the “TAB” key or click anywhere in the window, program will verify that the new value can be accepted and will present it formatted.

The START frequency is the frequency always generated by the DDS, if you want to use the sweeper, as a fixed generator, just enter here the frequency you want to output.

When the program is launched the generator is activated, a reset command is issued to the DDS, and the device is initialized to the START frequency.

Every time the START frequency is changed, the appropriate command is addressed to the DDS forcing to generate the new frequency.

The STOP frequency can be less or greater than the START frequency.

The sweeping run will always begin at the START frequency and the output will be increased or decreased until the STOP value is reached. Then cycle restarts.

The SWEEP ON button starts the sweeping run.

The number of steps managed by the program is 400 per each cycle, resolution is 1 Hz. Before to initialize the cycle, the program tests that the difference between the START and the STOP frequency is at least 400 Hz, in case of error request to select new frequencies is presented.

400 is the number of samples plotted on the Horizontal Frequency axe (X). The program automatically calculates the size of the single step and presents this value in Hz.

The max frequency of the Horizontal axe will be also calculated according with the START and the STEP frequencies.

The resolution of the Amplitude axe (Y) depends on the characteristic of the AD/C used.

While the SWEEP ON button is pressed his label is changed to SWEEP OFF.

Press it again will stop the sweeping process.

Three sweeping modes are available :

Standard : the measure from DUT is read once and plotted at every step.

Slow: the program reads 3 times the AD/C output per each step and calculates the average value.

Very slow: the AD/C output is read 5 times, the max and min values are ignored, the average value is calculated

Sweeping modes are available only when the h/w is interfaced via the parallel port.


Graphicarea

This is the area where the output of DUT is plotted

When the sweeping cycle is running the program reads back from the AD/C the 400 samples per cycle and real time plots them on the screen.

Different scales can be selected for the Amplitude Y axe:

Linear scale

Logarithmic 1V (1 Volt is the Vref)

Logarithmic 1V (1 Volt is the Vref) and 10dB of offset

Logarithmic 10V (10 Volt is the Vref)

To change the full scale value, click it and enter the new one.

Pressing the TAB key the scale is redraw according with the new value entered.

The graph will be refreshed based on the new scale.

The graph plotted can be analyzed selecting the view ‘TABLE’ from the menu bar or pressing the button “Table”.

The “Table” view lists the Frequency and the Amplitude (Volt or dB) of each sample received from the AD/C.

The mouse can be moved around the graph.

The position of the pointer is shown in the fields “Cursor position”

“SetUp / Preference” menu allows forcing the pointer to follow the path of the graph (white crossing lines) when moved.

The analysis of the graph can be also done with the help of markers.

Select the “View / Marker” from the menu or press the button “Marker”

The program presents the position of 4 markers: 2 for the Frequency axe (blue vertical lines) and 2 for the Amplitude axe (blue horizontal lines).

The value of the “Frequency” and “Volt/dB” of each marker are shown in the “Marker” windows

Position the marker moving the cursor over the graph then press the button’s mouse:

Marker | Mouse button
M1 | Click left
M2 | Click right
M3 | Shift + Click left
M4 | Shift + Click right

or click over the field “Frequency” for the marker M1 and M2, “Volt/dB” for the marker M3 and M4 and enter the new value.

Pressing the “TAB” key the program validates the value entered and design the new marker line on the screen.

The buttons

initialize the START or the STOP frequency with the current value of the marker M1 or M2.


Auxiliary commands area

Two auxiliary windows (menu “View / AUX1” and “View / AUX2”) allow interfacing:

- 2 digital circuits

- 1 analog device.

Command buttons were created here to manage the attenuator circuits that control the output of the DDS unit and the input from the AD/C.

The I2C standard protocol has been also implemented, this can interface several devices like digital potentiometers that are useful to control the gain of a linear amplifier.

The auxiliary command windows are very flexible and can be fully personalized, via the “SetUp / Configuration” menu. It is possible to assign to the windows any title like “Generator out” or change the description of the buttons and their values.

The Configuration paragraph details the different options available.

AUX 1 commands

8 bistable independent buttons are available in each window, one or more can be pressed at the same time.

The value of the pressed buttons is shown and updated each time a specific button changes the status.

8 output lines are connected to the 8 buttons (see the Hardware Interface paragraph), in order to drive 8 on/off devices.

The original design was focused to drive a couple of digital attenuators (Macom AT200, 4 bits, DC to 2GHz, 30dB att.) or an array of solid state rele.

AUX2 commands

A slide bar is also available in the second Auxiliary window (AUX2).

Use this command to interface a digipot device like the chip Maxim 1803 - Addressable Digital Potentiometer or any device that accepts the I2C bus/protocol.

Default design was devoted to control the gain of the input amplifier.


Import-Export an analysis

To save an analysis, select the menu “File / Export”, enter the filename and confirm.

A file containing the current analysis will be generated and saved.

The record layout is standard “csv” format, the field separator is the “,” comma sign.

This allows user to easily archive or import data into a spreadsheet for further analysis.

The first record labels the fields:

"Sample N","Frequency","DAC sample","milliVolt"

1,2500000,142,249

2,2506250,130,228

3,2512500,127,222

4,2518750,131,229

5,2525000,135,236

…………………

SAMPLE N = number of this sample (1 to 400)

Frequency = frequency in Hz

DAC sample = the byte read from the AD/C

milliVolt = value of the sample in milliVolt as plotted by the graph

The menu “File / Import” allows user to import a saved analysis.

Program tests the relationship between sample, milliVolt and current AD/C step.

If necessary the user is requested to accept that program will adjust the analysis to the new scale values or to keep the original data unchanged.


SetUp Menu


Detector calibration

Menu “SetUP / Calibrate Detector” allows the user to enter a positive or negative offset voltage that is added to the sample read from the AD/C.

1. Select 'View/Table' and 'Scale/Linear'.

2. Connect the input of the detector to a known voltage

3. Adjust the offset until the right voltage is presented.

4. Every time you 'Apply', table and graph will be updated with the new offset

The algorithm implemented is: Volt = Sample * Step + offset


Frequency generator calibration

Menu “SetUP / Calibrate Generator” allows the user to enter a positive or negative offset to the frequency generated by the DDS.

1. Select any start frequency.

2. Connect the output of the generator to a frequency meter.

3. Adjust the offset until the meter shows the right start frequency.

4. Apply

This offset is a number that is used to calculate the command word sent to the DDS:

For the AD9951 the word is the rounded result of:

Frequency * ( 2 ^ 32 / (Xtal Frequency * Multiplier)+Offset)

For the AD9851 when the 6xREFCLK is engaged, the word sent is:

Frequency * ( 2 ^ 32 / (Xtal Frequency * 6) + Offset)

or

Frequency * ( 2 ^ 32 / Xtal Frequency + Offset)

if the 6xREFCLK is disabled


Program configuration

First time program is launched, user is request to select the interface where the DDS generator and the other devices are connected.

1. Choose the interface according to your hardware.

2. Select the serial or the parallel port where your devices are connected

3. Press “APPLY”


Interface 2 – DDS/ADC connected to the LPT port

The Parallel Interface parameters that are selected when the “Default” button is pressed (see the file Sweep.in) are:

DDS Device=AD9851

DDS Multiplier=0

DDS Xtal freq=80000000

DDS Max freq=55000000

DDS Min freq=100000

DDS Offset=0

AD/C Device=8bit

AD/C Offset=0

AD/C Step=0,005

AD/C Channel=1

User can change any value, according the circuit design, accessing the window “DDS Generator”.

DDS supported are the Analog Device AD9850/AD9851 and AD9951.

If the AD9850 is used, no clock multiplier is required (Multiplier=0)

If AD9851 is selected and the internal 6xREFCLK multiplier should be engaged Multiplier=1 must be entered.

The Xtal frequency is entered in Hz, the program will calculate the frequency of the system clock based on the multiplier.

Example: device = AD9851, internal 6xREFCLK multiplier enabled (Multiplier=1), Xtal Frequency = 30000000, the system clock will be 180MHz

Max and Min frequency are the max and min values that can be selected for the START or STOP frequency, Analog Device recommend limiting the max value to the 40% of the system clock.

AD9850 DDS Generator

AD9951 DDS Generator

The frequency offset is entered from the menu “SetUp / Calibrate Generator”

Two AD/C chips are supported: the Texas Instruments TLC549 (8bits) and the TLC1549 (10 bits), those devices are pin to pin compatible.

AD/C Step is the value in milliVolt of the single step

Example:

step = 5mV for the 8bit TLC549 with Vref= 1.275 Volt

Step = 1.75 mV for the 10bit AD/C where the Vref = 1.8

Step is calculated as :

step = (Vmax – Vmin) / 2^ (AD/C bits)

where Vmin is usually tied to the GND and Vmax = Vref

The AD/C offset is entered from the menu “SetUp / Calibrate Detector”


Interface 3 – MiniVNA connected to the USB port

The “Interface 3” allows program to send commands and receive back data from the serial USB port.

Please refer to the “Reference manual for mRS antenna analyser type miniVNA 0.1-180 MHz” for any detail, and for the virtual serial driver needed to access to the USB port:

Download from FTDI web site the latest VCP (Virtual Com Port) for your OS (WIN2000/XP or WIN98), the chip is FTDI232BM, look at their web site http://www.ftdichip.com/Drivers/VCP.htm the latest right now for windows 2000/XP is http://www.ftdichip.com/Drivers/CDM/Win2000/CDM%202.00.00.zip


Auxiliary commands

The frames AUX1 and AUX2 can be fully personalized from the menu “SetUp / Configuration”.

Any frame can be disabled (NOT visible) checking the box “Enabled”.

1. This is the title shown when the frame is activated (menu “View / AUX1” or “View / AUX2”)

2. Button description, if this field is initialized “blank” the button will be disableb (NOT visible)

3. Button value. This is the numeric value that will be added or subtracted from the frame value when the button is pressed or released

8 output lines are connected to the 8 buttons of each frame (see the Hardware Interface paragraph), driving 8 on/off channels.

The checkbox “Negative logic” allows user to select when a button is pressed the positive (1) or negative (0) output.

A slide bar is also available in the AUX2 frame.

User can personalize the MIN and MAX values.

If MIN = MAX the slide bar will be disabled (NOT visible)

MIN and MAX must be a numeric value.

This command can be used to interface any device that accepts the I2C protocol (http://www.esacademy.com/faq/i2c/general/i2cproto.htm).

Any time the slide bar cursor is moved, the following command sequence, according with the specific of the device DS1803 Addressable Dual Digital Potentiomenter (Dallas Semiconductor – Maxim) bus is sent to the I2C:

Start

Write control byte = 80 (*)

Write command byte = 175 (*)

Write value = slide bar cursor position

Stop

(*) can be changed editing the [Aux2] section of the sweep.ini file


Software specs

The “SWEEP Generator” program was written in Visual Basic 6 and requires Windows 2000 or Windows XP to run.

Two processes were created: Sweep.exe and SweepAsync.exe.

Sweep.exe is the main window process.

This is the GUI that interacts with the user accepting commands and plotting the results of the sweeping cycles.

SweepAsync.exe is an ActiveX module that, launched by Sweep.exe, asynchronously runs in the background. No window access is provided.

This module receives the commands from the main process, interfaces the hardware devices via the serial or the parallel port issuing the requests to the DDS and tracking back the samples read from the AD/C.

It manages also the Auxiliary Commands.

The parallel port is driven by the freeware WinIo.sys v2.0 (http://www.internals.com) while the serial port uses the standard Microsoft VB controls.

All the variable parameters are stored in the Sweep.ini file.

This is an old style programming approach but it allows user to easily adapt the program to different hardware design. Most of the parameters are also accessible via the “SetUp / Configuration” menu for a much more comfortable editing.

The section:

[Config]

Interface=2

DDS Device=AD9951

……

identifies the current selected interface, the devices connected and parameters like Min and Max Frequency, AD/C step value etc.

The sections:

[Interface1]

DDS Device=AD9951

DDS Xtal freq= 13421773

……

[Interface2]

DDS Device=AD9851

DDS Multiplier=0

…....

implement the default original values for the specific interfaces. Those vales are moved to the section [Config] when a new interface is selected from the “SetUp / Configuration” menu.

Change here the Xtal Freq, the multiplier etc. according to your hardware before to select the interface.

The section:

[Sweep Generator]

Start=1200000

……

stores the last used values entered by the user like the START and STOP frequency, the markers position etc.

Sections :

[Serial Port]

CommPort=6

........

[Parallel Port]

LPT=&H378

.........

[Aux1]

Enabled=1

........

[Aux2]

Enabled=0

.......

store the parameters select via the ‘SetUp / Configuration’ menu that initialize the serial and the parallel interface or personalize the AUX windows.

Deleting the [Config] section, program is forced to restore the original status and user will be requested at the first program run, to enter the interface number (see yhe paragraph “Program configuration”).


Hardware Interface

Two different design of hardware interface can be connected:

Option A: the hardware is connected to the PC via the parallel port (LPT). The program directly drives the DDS unit and reads the output from the AD/C.

Option B: the DDS unit is driven by a PIC. The program interfaces via the serial port the PIC sending commands and receiving back the samples. The AD/C function is implemented by the PIC.

Sweep v2.0 can connect the following devices:

 | Project name /Author | PC port |
1 | Antonio Alfinito, I2TZK | USB | A PIC 16F877 controls an AD9951 DDS. The generator can be used stand alone without PC
2 | Wobbler by Peter Halick, OM3CPH | LPT | A ‘wobbler’ project with the AD9851 DDS is published here: http://www.qsl.net/om3cph/dds/wobbler.html
3 | MiniVNA by IW3EHW | USB | An Antenna Analyzer used as sweep generator http://www.miniradiosolutions.com


Interface 2 – DDS/AD/C connected to the LPT port

Please refer to http://www.qsl.net/om3cph/dds/wobbler.html for any technical detail related to the basic project by Peter Halick, OM2CPH and the additional solution implemented by Tomas, OK1UTS.

This is the block diagram of the original project

Any block can be implemented with a different circuit style, so far if a different DDS device like the AD9951 and a specific xtal frequency / clock multiplier will be used, the appropriate parameters must be initialized with the “SetUP / Configuration” menu.

The table lists the parallel port pins connection and the wiring managed by the program

LPT pin name | DB25 pin number | Block | Signal description
D0 | 2 | DDS, AUX1, AUX2, POT | Data out
D1 | 3 | DDS | Clock
D2 | 4 | DDS | Chip select
D3 | 5 | DDS | Reset (AD9951 only)
D4 | 6 | POT | Clock
D5 | 7 | AUX1, AUX2 | Clock
D6 | 8 | AUX1 | s/r clock
D7 | 9 | AUX2 | s/r clock
Paper End | 12 | AD/C | Data in
Strobe | 1 | AD/C | Clock
LineFeed | 14 | AD/C | Chip select
Reset | 16 |  | Sweep syncro

AUX1, AUX2 : array of 8 output (simulate 8 bistable buttons for a stepper attenuator)

POT: I2C bus, drives an I2C compliant chip (digipot for amplifier gain control)

The following figure is a reccomanded additional circuit for a safe interface between the PC parallel port and the DDS / ADC implementation.

In order to minimize the number of LPT pins, , a simple circuit driving a shift register SN74HC595 is requested to interface the AUX1 and AUX2 buttons array.

Positive or negative output when a button os pressed, can be selected configuring the AUX frame.

The slide bar of the frame AUX2 drivers the I2C bus at Pin 2 data and Pin 6 clock of the LPT port.

The device DS1803 is used, this component implements 2 digital potentiometer.

Program controls a the same time the two wipers, so both or just one potentiometer can be used.

The default address of the device is A0 = 0, A1 = 0 A3 = 0.

Any time the slide bar cursor is moved, the following command sequence, is sent to the I2C bus:

Start

Write control byte = 80 (*)

Write command byte = 175 (*)

Write value = slide bar cursor position

Stop

(*) can be changed editing the [Aux2] section of the sweep.ini file

A Syncro signal is also availabe at the Pin 16 Reset of the LPT port.

The signal is issued at the beginning of each sweeping cycle, this can be used to to syncronize an oscilloscope or with few additional components to generate a ramp signal during the sweep cycle.


Interface 3 – MiniVNA connected to the USB port

This device was primary designed as an Antenna Analyzer.

For any detail, please visit: http://www.miniradiosolutions.com

A limited approach allows using this device as a Sweep Generator.

Connect the input of the device under test to the miniVNA generator output “DUT” and his output to the “DET” input.

During the sweeping cycle the program reads back the detector output.

The “angle” or the “return loss” samples can be also acquired, if needed, the parameter “AD/C Channel” of the section [Config] of the sweep.ini file can be edited as follows:

AD/C Channel | Sample returned
1 | angle
2 | return loss
3 | detector

The default value from the Sweep.ini file are :

;--------------- miniVNA --------------------

[Interface3]

DDS Device=AD9951

DDS Multiplier=16

DDS Xtal freq=25000000

DDS Max freq=180000000

DDS Min freq=100000

DDS Offset=0

ADC Device=10bit

ADC Offset=0

ADC Step=0,00175

ADC Channel=3